<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="http://api.chinaola.net/ola/Application/Test/Public/css/mui.min.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="http://api.chinaola.net/ola/Application/Test/Public/css/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="http://api.chinaola.net/ola/Application/Test/Public/css/base.css"/>
    <style type="text/css">

        .circle {
            /*border-radius: 80%;*/
        }
        #firsthead{
            line-height: 52px;
            max-width: 52px;
            width: 52px;
            height: 52px;
            border-radius:52px;
        }
        #firstauthor{
            color:#000;
            margin:8px 0 2px 0;
        }
        .this_Title{
            overflow:hidden;
        }

        .comment {
            position: fixed;
            width: 100%;
            bottom: 0;
            background-color: lightgrey;
            padding: 5px;
            z-index: 200;
        }

        #comment {
            margin: 0 0 0 20px;
            height: 30px;
            /*line-height: 25px;*/
            width: 60%;
        }

        #sendcomment {
            height: 30px;
            font-size: 12px;
        }

        #firsttime {
            white-space: normal;
            padding:5px 0;
        }
        #firsttime span,#huifutime span{
            margin-left:10px;
        }
        h4, h5{
            white-space: normal;
        }
        #firsttitle{
            line-height:36px;
            font-size:22px;
        }
        .content_text{
            white-space: normal;
            color:#666;
        }
        .content_text img{
            width:100%;
            height:90vw;
        }
        p.content_text{
            line-height:24px;
            margin-bottom:24px;
        }
        #huifu{
            margin-top:10px;
        }
        #huifuhead{
            border-radius:100%;
            display:block;
            width:42px;
        }
        .mui-table-view:before{
            display:none;
        }
        .content_img img{
            width:100%;
            height:50vw;
        }
        #huifutitle{
            font-size:16px;
            color:#000000;
            padding:10px 0;
        }
        #huifutime{
            font-size:12px;
        }
        #huifutime span,#huifuauthor span{
            float:right;
            margin-right:10px;
        }
        #huifuauthor span{
            color:#000;
        }
        .mui-table-view-cell:after{
            left:0;
        }
        .mui-table-view .body_position{
            position:relative;
        }
        .Concern{
            color:#ffb4db;
            border:1px solid #ffb4db;
            padding:3px 12px;
            display:inline-block;
            font-size:13px;
            position:absolute;
            right:0;
            top:50%;
            -webkit-transform: translateY(-50%);
            -moz-transform: translateY(-50%);
            -ms-transform: translateY(-50%);
            -o-transform: translateY(-50%);
            transform: translateY(-50%);
        }
        .Concern:active{
            background: #ffb4db;
            color: #FFFFFF;
        }
        #first>li{
            overflow:hidden;
            position:relative;
            padding:11px 15px;
        }

        /*先隐藏*/
        /*#first>li:nth-last-child(1){*/
        /*display:None;*/
        /*}*/
        #jubao_diqun{
            position:absolute;
            right:40px;
            top:7px;
            font-size:12px;
            padding:2px 8px;
            border:1px solid #ffb4db;
            color: #ffb4db;
            z-index:999;
        }
        #jubao_diqun:active{
            background: #ffb4db;
            color:#fff;
        }
        #del{
            margin:0;
            font-size:13px;
            float:right;
        }
        #del:active{
            color: #ffb4db;
        }
        #order{
            position: fixed;
            bottom:0;
            left:0;
            display:block;
            width:100%;
            height:50px;
            line-height:50px;
            z-index:999;
            padding:0;
            background: #ffb5db;
            border:none;
            color:#fff;
        }

    </style>
</head>

<body>
<header class="mui-bar mui-bar-nav" style="background-color: #ffffff;">
    <h1 class="mui-title" id="title">主题贴</h1>
</header>
<!--下拉刷新容器-->
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
    <div class="mui-scroll">
        <ul id="first" class="mui-table-view">
        </ul>
        <ul id="huifu" class="mui-table-view">
        </ul>
    </div>
</div>
<button id="order" type="button" class="mui-btn mui-btn-warning mui-btn-outlined">前往App回复</button>

<script src="http://api.chinaola.net/ola/Application/Test/Public/js/mui.min.js"></script>
<script src="http://api.chinaola.net/ola/Application/Test/Public/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="http://api.chinaola.net/ola/Application/Test/Public/js/storage.js" type="text/javascript" charset="utf-8"></script>
<script src="http://api.chinaola.net/ola/Application/Test/Public/js/server.js" type="text/javascript" charset="utf-8"></script>
<script src="http://api.chinaola.net/ola/Application/Test/Public/js/findhuitielist.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    mui.init({
        pullRefresh: {
            container: '#pullrefresh',
            down: {
                callback: pulldownRefresh
            },
            up: {
                contentrefresh: '正在加载...',
                callback: pullupRefresh
            }
        }
    });

    var content_title;

    //获取地址栏信息
    function GetQueryString(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }

    //预约服务
    $("#order").click(function() {
        location.href = 'http://a.app.qq.com/o/simple.jsp?pkgname=o.dcloud.Stroke_hospital';
    });

    //对body添加一个touchstart事件
    document.body.addEventListener('touchstart', function () {});

    var title,content,tie_id;
    var postid = GetQueryString('postid');
        mui.ajax(showPostDetail, {
            data: {
                "id": GetQueryString('postid')
            },
            dataType: 'json', //服务器返回json格式数据
            type: 'post', //HTTP请求类型
            timeout: 10000, //超时时间设置为10秒；
            success: function(data) {
//                alert(JSON.stringify(data));
                tie_id = data.content[0].id;
                addcontent(data, "#first",postid);
                content_title = $("#firsttitle").text();
                addcomment(data, "#huifu");
                $('.del').remove();
                ceng();
            },
            error: function(xhr, type, errorThrown) {
                gotoerror();
            }
        });

        var token = lget('token');
        $('#sendcomment').click(function() {
            if(token == ""||token == null) {
                mui.alert('未登陆，请在个人中心登陆');
                mui.back();
            } else {
                if($("#comment").val() != ""){
                    var content = $('#comment').val();
                    //				alert(token+","+postid+","+content)
                    mui.ajax(doComment, {
                        data: {
                            'token': token,
                            'postid': postid,
                            'content': content
                        },
                        dataType: 'json', //服务器返回json格式数据
                        type: 'post', //HTTP请求类型
                        timeout: 10000, //超时时间设置为10秒；
                        success: function(data) {
                            mui.toast("评论成功");
                            window.location.reload();
                        },
                        error: function(xhr, type, errorThrown) {
                            mui.toast('网络连接失败');
                        }
                    });
                }else{
                    mui.toast("请输入评论内容");
                }
            }
        });

    //显示所有某个人留言
    var show_or_hide = 0;
    $("#huifu li").on("tap",function(){
//				var this_index = $(this).index();
//				$(".show_content").css("white-space","nowrap");
        if(show_or_hide == 0){
            $(this).find(".show_content").css("white-space","normal");
            show_or_hide = 1;
        }else{
            $(this).find(".show_content").css("white-space","nowrap");
            show_or_hide = 0;
        }
    });

    //楼层
    function ceng(){
        var this_index = $("#huifu li");
        for(c = 0;c<this_index.length;c++){
            this_index.eq(c).find("#huifutime b").text(c+1);
        }
    }

    /**
     * 下拉刷新具体业务实现
     */
    function pulldownRefresh() {
        setTimeout(function() {
            location.reload();
            mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
        }, 1500);
    }
    var count = 0;
    /**
     * 上拉加载具体业务实现
     */

    function pullupRefresh() {

        setTimeout(function() {

            mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > 1)); //参数为true代表没有更多数据了。
        }, 1500);
    }

</script>
</body>

</html>